//
//  PasswordChangeView.m
//  Comma
//
//  Created by 杜远洋 on 15-1-20.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "PasswordChangeView.h"
#import "GlobalMacro.h"
#import "GlobalMethod.h"
#import "AFNetWorkingYU.h"
#import "URLMacro.h"
#import "PasswordChangeModel.h"
@implementation PasswordChangeView

- (void)createMyChangePassword
{
    [self setBackgroundColor:[UIColor whiteColor]];
    
    [self myOldPassword];
    [self myNewPassword];
    [self repeatNewPassword];
    [self confirmMyChange];
    
}
- (void)setPasswordDic:(NSMutableDictionary *)passwordDic
{
    _passwordDic = passwordDic;
    [self createMyChangePassword];
}

- (void)myOldPassword
{
    UIView *oldView = [[UIView alloc] initWithFrame:CGRectMake(16, 64, SCREEN_WIDTH - 16, 88)];
    [oldView setBackgroundColor:[UIColor clearColor]];
    [self addSubview:oldView];
    
    
    self.oldPassword = [[UITextField alloc] initWithFrame:CGRectMake(0, 56, SCREEN_WIDTH - 16, 20)];
    [self.oldPassword setBackgroundColor:[UIColor clearColor]];
    [self.oldPassword setPlaceholder:@"旧密码"];
    [self.oldPassword setFont:[UIFont systemFontOfSize:14]];
    [oldView addSubview:self.oldPassword];
    
    [self myOldPasswordSeperateLine];
}
- (void)myOldPasswordSeperateLine
{
    [GlobalMethod drawLineWithStartPoint:CGPointMake(16, 152) EndPoint:CGPointMake(SCREEN_WIDTH, 152) inUIView:self];
}
- (void)myNewPassword
{
    UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(16, 152, SCREEN_WIDTH - 16, 44)];
    [newView setBackgroundColor:[UIColor clearColor]];
    [self addSubview:newView];
    
    self.newsPassword = [[UITextField alloc] initWithFrame:CGRectMake(0, 12, SCREEN_WIDTH - 16, 20)];
    [self.newsPassword setBackgroundColor:[UIColor clearColor]];
    [self.newsPassword setPlaceholder:@"新密码"];
    [self.newsPassword setFont:[UIFont systemFontOfSize:14]];
    [newView addSubview:self.newsPassword];
    
    [self myNewPasswordSeperateLine];
}
- (void)myNewPasswordSeperateLine
{
    [GlobalMethod drawLineWithStartPoint:CGPointMake(16, 196) EndPoint:CGPointMake(SCREEN_WIDTH, 196) inUIView:self];
    
}
- (void)repeatNewPassword
{
    UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(16, 196, SCREEN_WIDTH - 16, 44)];
    [newView setBackgroundColor:[UIColor clearColor]];
    [self addSubview:newView];
    
    self.repeatPassword = [[UITextField alloc] initWithFrame:CGRectMake(0, 12, SCREEN_WIDTH - 16, 20)];
    [self.repeatPassword setBackgroundColor:[UIColor clearColor]];
    [self.repeatPassword setPlaceholder:@"重复新密码"];
    [self.repeatPassword setFont:[UIFont systemFontOfSize:14]];
    [newView addSubview:self.repeatPassword];
    
    [self repeatNewPasswordSeperateLine];
}
- (void)repeatNewPasswordSeperateLine
{
    [GlobalMethod drawLineWithStartPoint:CGPointMake(16, 240) EndPoint:CGPointMake(SCREEN_WIDTH, 240) inUIView:self];
}
- (void)confirmMyChange
{
    UIView *confirm = [[UIView alloc] initWithFrame:CGRectMake(16, 284, SCREEN_WIDTH - 16, 176)];
    [confirm setBackgroundColor:[UIColor clearColor]];
    [self addSubview:confirm];
    
    self.confirmButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 145, SCREEN_WIDTH - 32, 20)];
    [self.confirmButton setBackgroundColor:[UIColor clearColor]];
    [self.confirmButton setTitle:@"确认修改" forState:UIControlStateNormal];
    [self.confirmButton setTitleColor:REDCOLOR forState:UIControlStateNormal];
    self.confirmButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [confirm addSubview:self.confirmButton];
    
    [self confirmSeperateLine];
}
- (void)confirmSeperateLine
{
    [GlobalMethod drawLineWithStartPoint:CGPointMake(16, 460) EndPoint:CGPointMake(SCREEN_WIDTH, 460) inUIView:self];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self endEditing:YES];
}

@end
